<?php
/**
 * Created by PhpStorm.
 * User: 小蛮哼哼哼
 * Email: 243194993@qq.com
 * Date: 2021/5/22
 * Time: 12:00
 * motto: 现在的努力是为了小时候吹过的牛逼！
 */

declare(strict_types=1);

namespace app\common\lib;


class Show
{
    public static function json_show(int $code = 0, string $msg = '', array $data = [], int $count = 0)
    {
        $result = [
            "code" => $code,
            "msg" => $msg,
            "data" => $data,
            "count" => $count
        ];
        return json($result);
    }

    public static function json_msg(array $data = [])
    {
        return json_encode($data, JSON_UNESCAPED_UNICODE);
    }

    /**
     * @param string $state
     * @param string $url
     * @param string $title
     * @param string $original
     * @return \think\response\Json
     */
    public static function json_ueditor(string $state = "SUCCESS", string $url = "https://baidu.com", string $title = 'aa', string $original = 'aa')
    {
        $result = [
            "state" => $state,
            "url" => $url,
            "title" => $title,
            "original" => $original
        ];
        return json($result);
    }
}